# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=gdk-pixbuf2
pkgname=(gdk-pixbuf2 gdk-pixbuf2-docs)
pkgver=2.42.10
pkgrel=2
pkgdesc="An image loading library"
url="https://wiki.gnome.org/Projects/GdkPixbuf"
arch=(loong64 x86_64)
license=(LGPL)
depends=(glib2 libpng libtiff libjpeg shared-mime-info)
makedepends=(gobject-introspection git meson gi-docgen python-docutils)
optdepends=(
  "libwmf: Load .wmf and .apm"
  "libopenraw: Load .dng, .cr2, .crw, .nef, .orf, .pef, .arw, .erf, .mrw, and .raf"
  "libavif: Load .avif"
  "libheif: Load .heif, .heic, and .avif"
  "libjxl: Load .jxl"
  "librsvg: Load .svg, .svgz, and .svg.gz"
  "webp-pixbuf-loader: Load .webp"
)
options=(debug)
_commit=9ac257eb38f772fec4253e8051743029e75a2acd  # tags/2.42.10^0
source=(
  "git+https://gitlab.gnome.org/GNOME/gdk-pixbuf.git#commit=$_commit"
  gdk-pixbuf-query-loaders.hook
)
sha256sums=('SKIP'
            '9fb71d95e6a212779eb0f88dde5a3cee0df7f4d9183f8f9ce286f8cdc14428f0')

pkgver() {
  cd gdk-pixbuf
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd gdk-pixbuf
}

build() {
  arch-meson gdk-pixbuf build \
    -D builtin_loaders=all \
    -D gtk_doc=true \
    -D installed_tests=false
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_gdk-pixbuf2() {
  provides=(libgdk_pixbuf-2.0.so)
  install=gdk-pixbuf2.install

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc

  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 *.hook
}

package_gdk-pixbuf2-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
